<?php

declare(strict_types=1);

namespace App\Model;

use Hyperf\Database\Model\SoftDeletes;
use Hyperf\DbConnection\Model\Model;

class Menu extends Model
{
    const MENU_CACHE_KEY = 'MENU_CACHE_KEY';

    const STATUS_SHOW = 1;
    const STATUS_HIDE = 0;

    use SoftDeletes;

    public static $statusLabel = [
        self::STATUS_SHOW => '显示',
        self::STATUS_HIDE => '隐藏',
    ];
    protected ?string $table = 'system_menu';

    public function module()
    {
        return $this->hasOne(Module::class, 'id', 'module_id');
    }

    public function control()
    {
        return $this->hasOne(MenuControl::class, 'controller', 'controller');
    }
}
